import com.sun.corba.se.spi.orbutil.threadpool.Work;

import java.util.ArrayList;
import java.util.List;

public class Demo02 {
    //有3个学生(学号\姓名\年龄)要存储在集合中
    public static void main(String[] args) {
        Student stu1=new Student();
        stu1.setStuid(1);
        stu1.setStuname("张三");
        stu1.setAge("18");
        Student stu2=new Student(2,"lisi","19");
        Student stu3=new Student(3,"王五三","21");
        ArrayList<Student> studentList=new ArrayList<>();
        studentList.add(stu1);
        studentList.add(stu2);
        studentList.add(stu3);
        System.out.println("一共有"+studentList.size()+"个学生");


//        if (studentList.contains(stu1)){ //判断集合中是否存在改对象
//            studentList.remove(stu1); //删除
//        }
        for (Student student : studentList) { //打印学生姓名中包含“三”的学生
             String stuname=student.getStuname();
             if (stuname.contains("三")){
                 System.out.println(student);
             }
        }
    }
}
